package com.cmcc.linlaker.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.cmcc.linlaker.R;


public class ExitDialog extends Dialog implements View.OnClickListener {

    public ExitDialog(Context context) {
        super(context);
    }


    public ExitDialog(Context context, int theme) {
        super(context, theme);
    }

    protected ExitDialog(Context context, boolean cancelable,
                         OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }


    private TextView text_cancel, text_ok, text_content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_exit);

        text_cancel = findViewById(R.id.text_cancel);
        text_ok = findViewById(R.id.text_ok);
        text_content = findViewById(R.id.text_content);

        text_ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();

                onConfirmClickListener.onConfirmClick();
            }
        });

        text_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

    public void setConfirmText(String text){
     text_ok.setText(text);
    }
    public void setContent(String content) {
        text_content.setText(content);
    }

    public interface OnConfirmClickListener {
        void onConfirmClick();
    }

    private OnConfirmClickListener onConfirmClickListener;

    public void setOnConfirmClickListener(OnConfirmClickListener onConfirmClickListener) {
        this.onConfirmClickListener = onConfirmClickListener;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            default:
                break;
        }
    }
}
